using System.Collections.Generic;
using System.Windows;
using System.Windows.Markup;
using SProject;
using SProject.Program;

namespace ProjectView.Windows
{
    public partial class UseProgramWindow : Window
    {
        public UseProgramWindow()
        {
            InitializeComponent();
        }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            base.DialogResult = true;
            Close();
        }

        public void SetList(List<Project> list)
        {
            gridProjectNameList.ItemsSource = list;
            gridProjectNameList.SelectedIndex = 0;
        }

        public PCRProgram GetProgram()
        {
            PCRProgram pCRProgram = null;
            Project project = gridProjectNameList.SelectedItem as Project;
            if (project != null)
            {
                pCRProgram = new PCRProgram();
                pCRProgram.Copy(project.PCRProgram);
            }
            return pCRProgram;
        }
    }
}
